<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateCategoryStatisticsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('category_statistics', function (Blueprint $table) {
            $table->increments('id');
            $table->date('date')->nullable();
            $table->integer('type')->default(1);
            $table->integer('goods_count')->default(0);
            $table->decimal('goods_amount', 10, 2)->default(0);
            $table->integer('goods_return_count')->default(0);
            $table->decimal('goods_return_amount', 10, 2)->default(0);
            $table->decimal('goods_return_rate', 10, 2)->default(0);
            $table->text('json')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('category_statistics');
    }
}
